<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN"> 
<head>
	
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="js/jquery/jquery.js"></script>

	<!-- INCLUDE meta.html -->

</head>


<body>
<div class='maindiv'>

<div class="headerdiv">
	<!-- INCLUDE header.html -->
</div>

<div id='contentdiv'>
	<div id='left'>
    	<div style="margin:10px;margin-top:30px;">
        	<ul>
                <li><a href="javascript:new_user();">{NEW_USER}</a></li>
            </ul>
    		
        </div>
    </div>
    <div id='maindiv'>
    	<div class="description">
			{page_description}
        </div>
        
        <!-- IF err_msg -->
        <div class="err_msg pad">
        	{err_msg}
        </div>
        <!-- ENDIF -->
        
        <!-- IF success_msg -->
        <div class="success_msg pad">
        	{success_msg}
        </div>
        <!-- ENDIF -->
        
        <div class="real_content">
        	<div id="new_user" style="display:<!-- IF user --><!-- ELSE -->none<!-- ENDIF -->;margin:20px;background-color:#FFFF99;width:400px;">
            	<h2>{NEW_USER}</h2>
        		<!-- INCLUDE user_new.html -->
            </div>
            <!-- INCLUDE user_list.html -->
        </div>
        
    </div>
</div>

<div id="change_password" style="display:none;position:absolute;background-color:#FFFF99;width:200px;">
        	 <table>
             	<tr>
                	<td valign="top">{USER_NAME}</td>
                    <td><input type="text" class="inputtext" style="width:100px;" id='change_password_user' disabled="disabled" /></td>
                </tr>
                <tr>
                	<td valign="top">{USER_PASSWORD}</td>
                    <td><input type="password" class="inputtext" password="1"  style="width:100px;" /></td>
                </tr>
          
                <tr>
                	<td valign="top">{USER_PASSWORD_CONFIRM}</td>
                    <td><input type="password" class="inputtext" password="2"  style="width:100px;" /></td>
                </tr>
                <tr>
                	<td colspan="2" align="center">
                    	<input type="button" value="{USER_SUBMIT}" onclick="do_change_password(); return false;" />
                        <input type="button" value="{CANCEL}" onclick="$('#change_password').slideUp(200); return false;" />
                    </td>
                </tr>
             </table>
</div>


<script>
$('.change_password').bind('mouseover',function()
{
	$(this).addClass('text_mouseover'); 
});

$('.change_password').bind('mouseout',function(){ $(this).removeClass('text_mouseover'); });

function change_password(event,name,id)
{
	$('#change_password_user').val(name);
	$('[password]').val('').attr('user_id',id);
	$('#change_password')
		.css( { left:event.clientX+$(document).scrollLeft(),top:event.clientY+$(document).scrollTop() } )
		.slideDown(200);
}

function do_change_password()
{
	if ($('[password=1]').val() != $('[password=2]').val())
	{
		alert('{PASSWORD_NOT_THE_SAME}');
		return;
	}
	else
	{
		var p = $('[password=1]');
		$.post("admin.php?p=ajax&m=update_password&table=user&id="+p.attr('user_id'),{ value:p.val()},change_password_callback);
	}
}

function change_password_callback(s)
{
	if (s == 'success')
	{
		alert('{USER_UPDATE_SUCCESS}');
	}
	else
	{
		alert(s);
	}
	$('#change_password').slideUp(200);
}

function delete_user(id,o)
{
	$(o).attr('to_be_delete','yes').html('{DELETING}').unbind('click');
	$.post('admin.php?p=ajax&m=delete&table=user&id='+id,{ },delete_callback);
}

function delete_callback(s)
{
	if (s == 'error')
	{
		alert('{DELETE_ERROR}');
		return false;
	}
	$('[to_be_delete=yes]').parent().parent().fadeOut();
}

function new_user()
{
	$('#new_user').fadeTo(10,0).slideDown(200).fadeTo('fast',1);
}

function cancel_new_user()
{
	$('#new_user').fadeTo('fast',0).slideUp(200);
}

</script>

<!-- INCLUDE footer.html -->

</div>
</body>
</html>